package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Category;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CategoryMapper {
    List<Category> findByPage();
    void save(Category category);
    @Transactional
    void update(Category category);
    void delete(Long id);
    @Select("select * from category where name=#{name}")
    Category findByName(String name);

    List<Category> findByType(Integer type);

    //根据cid查询类别对象
    @Select("select * from category where id=#{cid}")
    Category findByCid(Long cid);
}
